<!-- @format -->
<template>
  <div>
    <MyProduct
      :info="info"
      :price="price"
      :title="title" />
  </div>
</template>

<script>
  // 父传子的应用场景：解决子组件数据不确定的问题
  import MyProduct from './components/MyProduct.vue'
  export default {
    components: {
      MyProduct
    },
    data() {
      return {
        info: '炒鸡好吃,还不贵',
        price: 999,
        title: '超可爱的可爱多'
      }
    }
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  .list {
    width: 990px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
  }
  .item {
    width: 240px;
    margin-left: 10px;
    padding: 20px 30px;
    transition: all 0.5s;
    margin-bottom: 20px;
  }

  .item:nth-child(4n) {
    margin-left: 0;
  }

  .item:hover {
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
    transform: translate3d(0, -4px, 0);
    cursor: pointer;
  }

  .item img {
    width: 100%;
  }

  .item .name {
    font-size: 18px;
    margin-bottom: 10px;
    color: #666;
  }

  .item .price {
    font-size: 22px;
    color: firebrick;
  }

  .item .price::before {
    content: '¥';
    font-size: 14px;
  }
</style>
